<template>
    <div>
        我是给的页面
        <div>
            <label for="">
                名字：
                <input type="text" v-model="inputData" />
            </label>
        </div>

        <button @click="getData">传值</button>
    </div>
</template>

<script>
export default {
    data() {
        return {
            inputData: '',
            age: 18
        };
    },
    // 组件内独享的守卫
    beforeRouteEnter(to, from, next) {
        console.log('这是组件独享守卫');
        next();
    },
    mounted() {},
    methods: {
        getData() {
            let obj = {
                name: this.inputData,
                age: this.age,
                height: 176
            };
            this.$router.push({
                path: '/msg',
                query: obj
            });
        }
    }
};
</script>

<style></style>
